.TH E1432_GET_MEAS_STATE 3 E1432
.SH NAME
e1432_get_meas_state \- Get measurement state
.IX e1432_get_meas_state(3) 3
.SH SYNOPSIS
.cS
SHORTSIZ16 e1432_get_meas_state(E1432ID hw, SHORTSIZ16 ID,
                                SHORTSIZ16 *state)
.cE
.SH DESCRIPTION
\fIe1432_get_meas_state\fR gets the current state of the measurement
loop that runs in an E1432 module.

\fIhw\fR must be the result of a successful call to
\fIe1432_assign_channel_numbers\fR, and specifies the group of
hardware to talk to.

\fIID\fR is either the ID of a group of channels that was obtained
with a call to \fIe1432_create_channel_group\fR, or the ID of a single
channel.  If the ID is a group ID, and if the modules in the group are
not all at the same measurement state, then this function tries to
figure out the "lowest" state that they are all in, and returns that.
When determining the "lowest" state, this function tries to take into
account the fact that \fBIDLE\fR follows \fBCONVERT_WAIT2\fR, and
tries to come up with the state of the module which is furthest behind
in the measurement loop.

\fIstate\fR is a pointer to a 16-bit int, and will be filled with the
current measurement state.  The measurement state will be one of:

.nf
\fBE1432_MEAS_STATE_TESTED
E1432_MEAS_STATE_BOOTING
E1432_MEAS_STATE_BOOTING_WAIT1
E1432_MEAS_STATE_BOOTING_WAIT2
E1432_MEAS_STATE_BOOTED
E1432_MEAS_STATE_SYNC
E1432_MEAS_STATE_SYNC_WAIT1
E1432_MEAS_STATE_PRE_ARM
E1432_MEAS_STATE_PRE_ARM_WAIT2
E1432_MEAS_STATE_IDLE
E1432_MEAS_STATE_ARM
E1432_MEAS_STATE_ARM_WAIT1
E1432_MEAS_STATE_ARM_WAIT2
E1432_MEAS_STATE_TRIGGER
E1432_MEAS_STATE_CONVERT
E1432_MEAS_STATE_CONVERT_WAIT1
E1432_MEAS_STATE_CONVERT_WAIT2
E1432_MEAS_STATE_ERROR
E1432_MEAS_STATE_ERROR_WAIT1
E1432_MEAS_STATE_ERROR_WAIT2
E1432_MEAS_STATE_TPUT\fR
.fi

The following is more details about the measurement state than you
really wanted to know:

\fBE1432_MEAS_STATE_TESTED\fR

    No measurement running.  This state is what the module goes to at
    boot-up, and after e1432_reset_measure.  Sync/Trig high, module
    waiting for it to go low to indicate start of measurement.  A meas
    state change interrupt is generated when the module reaches this
    state from a different state.

\fBE1432_MEAS_STATE_BOOTING\fR

    Measurement starting, module doing setup and testing parameters
    for consistency.  Sync/Trig held low.

\fBE1432_MEAS_STATE_BOOTING_WAIT1\fR

    Module done doing setup, waiting for all SCAs to be ready for
    measurement sync.  Sync/Trig held low.

\fBE1432_MEAS_STATE_BOOTING_WAIT2\fR

    Module done doing setup, all SCAs ready for measurement sync.
    Module releases Sync/Trig line, and is waiting for the line to go
    high.

\fBE1432_MEAS_STATE_BOOTED\fR

    Sync/Trig high, module waiting for it to go low to indicate the
    measurement sync.  A meas state change interrupt is generated when
    the module reaches this state from a different state.

\fBE1432_MEAS_STATE_SYNC\fR

    Measurement sync just happened, all inputs start collecting
    data.  Sync/Trig held low.  Fall through to next state.

\fBE1432_MEAS_STATE_SYNC_WAIT1\fR

    Module waiting for input digital filters to finish settling.
    Sync/Trig held low.

\fBE1432_MEAS_STATE_PRE_ARM\fR

    Module done waiting for digital filter settling, now waiting for
    measurement pre-arm.  Sync/Trig held low.  A meas state change
    interrupt is generated when the module reaches this state from a
    different state.

\fBE1432_MEAS_STATE_PRE_ARM_WAIT2\fR

    Module done waiting for pre-arm.  Module releases Sync/Trig line,
    and is waiting for the line to go high.

\fBE1432_MEAS_STATE_IDLE\fR

    Sync/Trig high, module waiting for it to go low to indicate
    measurement arm.  A meas state change interrupt is generated when
    the module reaches this state from a different state.

\fBE1432_MEAS_STATE_ARM\fR

    Measurement arm just happened.  Sync/Trig held low.  Fall through
    to next state.  A meas state change interrupt is generated when
    the module reaches this state from a different state.

\fBE1432_MEAS_STATE_ARM_WAIT1\fR

    Module waiting for pre-trigger acquisition to complete, and for
    sources to be ready for trigger.  Sync/Trig held low.

\fBE1432_MEAS_STATE_ARM_WAIT2\fR

    Pre-trigger acquisition done, sources ready for trigger.  Module
    releases Sync/Trig line, and is waiting for the line to go high.

\fBE1432_MEAS_STATE_TRIGGER\fR

    Sync/Trig high, module waiting for it to go low to indicate
    measurement trigger.  A meas state change interrupt is generated
    when the module reaches this state from a different state.

\fBE1432_MEAS_STATE_CONVERT\fR

    Measurement trigger just happened.  Sync/Trig held low.  Fall
    through to next state.  A meas state change interrupt is generated
    when the module reaches this state from a different state.

\fBE1432_MEAS_STATE_CONVERT_WAIT1\fR

    Module waiting for input data block to be acquired, and for source
    burst to complete.  Sync/Trig held low.  If the module is in
    continuous mode, it stays here until FIFO overflow.  If the module
    is in overlap block or overlap free-run mode, it does not wait for
    input data block to be acquired.

\fBE1432_MEAS_STATE_CONVERT_WAIT2\fR

    Previous state completed, Sync/Trig line released, module waiting
    for it to go high.  The next state will be TESTED if the module
    was in continuous mode, or IDLE otherwise.

\fBE1432_MEAS_STATE_DUMMY\fR

    Dummy state, never reached.

\fBE1432_MEAS_STATE_ERROR\fR
\fBE1432_MEAS_STATE_ERROR_WAIT1\fR
\fBE1432_MEAS_STATE_ERROR_WAIT2\fR

    Transitional states reached only briefly if an error happens during
    a measurement.  The next state will be TESTED.

\fBE1432_MEAS_STATE_DUMMY2\fR

    Dummy state, never reached.

\fBE1432_MEAS_STATE_TPUT\fR

    Used only when doing thruput to the local bus, and at the same
    time sending data over VME (the data port parameter set to
    \fBE1432_SEND_PORT_LBUS_EAVES\fR).  If an RPM armed or time armed
    measurement is done, eventually the RPM armed or time armed
    measurement completes.  However, this does not cause the time data
    that is sent to the local bus to stop.  Instead, the local bus
    data continues, and the measurement state switches to
    \fBE1432_MEAS_STATE_TPUT\fR.  The local bus data continues until
    the measurement is reset.

.SH "RESET VALUE"
After a reset, the measurement state is \fBE1432_MEAS_STATE_TESTED\fR.
.SH "RETURN VALUE"
Return 0 if successful, a (negative) error number otherwise.
.SH "SEE ALSO"
.na
e1432_init_measure
.ad
